home *** CD-ROM | disk | FTP | other *** search
/ Total Network Tools 2002 / NextStepPublishing-TotalNetworkTools2002-Win95.iso / Archive / Browser Speed / WebWarper.exe / HTML / 130 < prev    next >
Encoding:
Text File  |  2001-05-04  |  1.8 KB  |  70 lines

  1. <script language="VBScript">
  2.  
  3. Sub OnContextMenu()
  4.     On Error Resume Next
  5.     set l = external.menuArguments.document.parentWindow.top.document.location
  6.     a = "" & l.href
  7.     if Err then
  8.         Err.Clear
  9.         set l = external.menuArguments.document.location
  10.     end if
  11.     a = "" & l.href
  12.     if InStr(a, "http://") <> 1 then
  13.         alert "Sorry, WebWarper is not applicable for this page. " & Chr(13) _
  14.             & "It is viewed through the """ & l.protocol _
  15.             & """ protocol," & Chr(13) & "but WebWarper can be used only with " _
  16.             & "pages viewed" & Chr(13) & "through the ""http://"" protocol."
  17.         exit sub
  18.     end if
  19.    if InStr(1, a, "http://siams.com", 1) <> 1 then exit sub
  20.    a = Right(a, Len(a)-Len("http://siams.com"))
  21.  
  22.    i1 = InStr(a,"/ww.pl/")
  23.    i2 = InStr(a,"/ww.pl?")
  24.     if (i1 < 1) and (i2 < 1) then exit sub
  25.     if i1 >= 1 then
  26.         if i1 > 1 then
  27.             port = Left(a,i1-1)
  28.             if Left(port,1) <> ":" then exit sub
  29.             port = Right(port,Len(port)-1)
  30.             if CStr(CInt(port)) <> port then exit sub
  31.         end if
  32.         a = Right(a, Len(a)-Len("/ww.pl/")-i1+1)
  33.     elseif i2 >= 1 then
  34.         if i2 > 1 then
  35.             port = Left(a,i2-1)
  36.             if Left(port,1) <> ":" then exit sub
  37.             port = Right(port,Len(port)-1)
  38.             if CStr(CInt(port)) <> port then exit sub
  39.         end if
  40.         a = Right(a, Len(a)-Len("/ww.pl?")-i2+1)
  41.         if LCase(Left(a,5))="info=" then exit sub
  42.         if LCase(Left(a,5))="lang=" then exit sub
  43.     end if
  44.  
  45.     if InStr(a, "~") = 1 then a = Right(a, Len(a)-InStr(a, "/"))
  46.     if InStr(a, "/") = 1 then a = "siams.com" & a
  47.     a = "http://" & a
  48.     h = ""
  49.     p = InStr(a, "#")
  50.     if p > 0 then
  51.         h = Right(a, Len(a)-p+1)
  52.         a = Left(a, p-1)
  53.     end if
  54.     p = InStr(a, "?*")
  55.     if p = Len(a)-1 then
  56.         l.href = Left(a, p-1) & h
  57.         exit sub
  58.     end if
  59.     p = InStr(a, "&*")
  60.     if p = Len(a)-1 then
  61.         l.href = Left(a, p-1) & h
  62.         exit sub
  63.     end if
  64.     l.href = a & h
  65. end sub
  66.  
  67. OnContextMenu()
  68.  
  69. </script>
  70.